<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreatePayLogTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('pay_log', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('user_id')->comment('用户');
            $table->unsignedBigInteger('member_id')->comment('会员id');
            $table->string('pay_code',100)->comment('订单号');
            $table->tinyInteger('pay_type')->default(0)->comment('支付类型1=微信2=支付宝');
            $table->tinyInteger('pay_amount')->comment('支付金额');
            $table->tinyInteger('status')->comment('支付状态：0=待支付，1=支付成功，2支付失败');
            $table->string('pay_sn')->nullable()->comment('三方支付平台订单号');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('pay_log');
    }
}
